// /common/http.api.js

// 如果没有通过拦截器配置域名的话，可以在这里写上完整的URL(加上域名部分)
// let hotSearchUrl = '/ebapi/store_api/hot_search';
// let indexUrl = '/ebapi/public_api/index';

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 登录
	let login = (params = {}) => vm.$u.get(`/wx/user/${params.appid}/login`, params);
	// 授权
	let auth = (params = {}) => vm.$u.post(`/wx/user/${params.appid}/postAuth`, params);

	let authphoneNumber = (params = {}) => vm.$u.post(`/wx/user/${params.appid}/phone`, params);


	//  获取文章当前状态
	let articleUserStatus = (params = {}) => vm.$u.post(`/mobile/wind/check/articleUserStatus`, params);


	//  获取文章当前状态
	let shareArticleUserStatus = (params = {}) => vm.$u.post(`/mobile/wind/check/shareArticleUserStatus`, params);

	//  点击收藏文章信息。
	let saveCollection = (params = {}) => vm.$u.get('/mobile/wind/check/articleCollection/' + params.articleId);

	//  点击收藏技术分享文章信息。
	let saveShareCollection = (params = {}) => vm.$u.get('/mobile/wind/check/shareArticleCollection/' + params
		.articleId);

	// 点击收藏 消缺故障 信息
	let saveFaultCollection = (params = {}) => vm.$u.get('/mobile/wind/check/faultArticleCollection/' + params
		.articleId);



	//  技术分享取消收藏
	let shareCollectionCancel = (params = {}) => vm.$u.get('/mobile/wind/check/shareCollectionCancel/' + params
		.articleId);


	// 	// 故障消缺收藏
	// let saveFaultCollectionCancel = (params = {}) => vm.$u.get('/mobile/wind/check/faultCollectionCancel/' + params
	// 	.articleId);
	//  取消收藏
	let saveCollectionCancel = (params = {}) => vm.$u.get('/mobile/wind/check/articleCollectionCancel/' + params
		.articleId);


	//  点赞
	let saveLikes = (params = {}) => vm.$u.get('/mobile/wind/check/articleLike/' + params.articleId);

	//  点赞 技术分享 点赞
	let saveShareLikes = (params = {}) => vm.$u.get('/mobile/wind/check/shareArticleLike/' + params.articleId);

	//  点赞 消缺故障 点赞
	let saveFaultLikes = (params = {}) => vm.$u.get('/mobile/wind/check/faultArticleLike/' + params.articleId);

	//  取消点赞
	let saveLikesCancel = (params = {}) => vm.$u.get('/mobile/wind/check/articleLikeCancel/' + params.articleId);



	//  关注
	let saveFollow = (params = {}) => vm.$u.post('/mobile/wind/check/articleUserFollow', params);
	//  取消关注
	let saveFollowCancel = (params = {}) => vm.$u.post('/mobile/wind/check/articleUserFollowCancel', params);


	//  根据父id 查询 子评论
	let getPCommentsByArticleIdChil = (params = {}) => vm.$u.get(
		`/mobile/wind/getPCommentsByArticleIdChil/${params.cId}`);

	//  分享技术 类型的 评论
	let getPCommentsByArticleIdShare = (params = {}) => vm.$u.get('/mobile/wind/getPCommentsByShareArticleId/' +
		params.articleId);

	//  故障消缺 类型的 评论
	let getPCommentsByArticleIdFault = (params = {}) => vm.$u.get('/mobile/wind/getPCommentsByFaultArticleId/' +
		params.articleId);






	// 保存
	let saveWindPowerInfo = (params = {}) => vm.$u.post('/wind/cable', params);
	let getModelArea = (params = {}) => vm.$u.get('/wind/specificationsModel/adjacentModeInfo',
		params);



	// 获取用户发布的文章
	let articleTypeListAll = (params = {}) => vm.$u.get('/wind/articleinfo/listAll', params);

	//  获取用户 关注数量，粉丝数量，点赞数量
	let getUserInfoListCount = (params = {}) => vm.$u.get(
		`/mobile/wind/check/getUserInfoListCount/${params.userId}`);

	//  获取用户 关注列表
	let getMyFollowList = (params = {}) => vm.$u.get(`/mobile/wind/check/getMyFollowList/${params.userId}`);

	// 获取技术分享数据
	// let getShareDetail = (params = {}) => vm.$u.get(`/mobile/wind/getShareDetail/${params.shareId}`);
	
	let getShareDetail = (params = {}) => vm.$u.get(`/mobile/wind/check/getShareDetail/${params.shareId}`);


    //删除技术分享
    let deleteShareDetail= (params = {}) => vm.$u.get(`/mobile/wind/deleteShareDetail/${params.shareId}`);


	// 获取消缺信息
	let getShareDetailFault = (params = {}) => vm.$u.get(`/mobile/wind/getShareDetailFault/${params.shareId}`);
//删除消缺
let deleteShareDetailFault = (params = {}) => vm.$u.get(`/mobile/wind/deleteShareDetailFault/${params.shareId}`);

	// 保存技术分享 信息。
	let saveShareTechnology = (params = {}) => vm.$u.postJson('/mobile/wind/check/saveShareInfo', params);

	// 获取技术分享 信息
	let getWindShareTechnology = (params = {}) => vm.$u.get('mobile/wind/shareTechnologyList', params);

	// 获取故障消缺信息列表
	let getWindShareFaultList = (params = {}) => vm.$u.get('mobile/wind/shareFaultList', params);

	// 保存故障消缺内容
	let saveShareFault = (params = {}) => vm.$u.postJson('/mobile/wind/check/saveFaultInfo', params);

	// 保存积分
	let saveUserIntegralConsumptions = (params = {}) => vm.$u.postJson(
		'/mobile/wind/check/saveUserIntegralConsumptions', params);
		
		// 打赏积分
	let exceptionalIntegral = (params = {}) => vm.$u.postJson(
		'/mobile/wind/check/exceptionalIntegral', params); 
		
	// 获取评论信息，修改为已采纳
	let getCommentInfo = (params = {}) => vm.$u.get(`/mobile/wind/getCommentInfo/${params.commentId}`);
			

	// 获取技术分享所有文章
	let getMyArticleList = (params = {}) => vm.$u.get('/mobile/wind/check/getMyArticleList', params);

	//  获取 用户收藏信息
	let getUserCollectionList = (params = {}) => vm.$u.get('/mobile/wind/check/getUserCollectionList', params);

	vm.$u.api = {
		login,
		auth,
		authphoneNumber,
		articleUserStatus,
		shareArticleUserStatus,
		saveCollection,
		saveCollectionCancel,
		saveLikes,
		saveLikesCancel,
		saveFollow,
		saveFollowCancel,
		getPCommentsByArticleIdChil,
		saveWindPowerInfo,
		getModelArea,
		getUserCollectionList,
		articleTypeListAll,
		getUserInfoListCount,
		getMyFollowList,
		getShareDetail,
		getShareDetailFault,
		saveShareTechnology,
		getWindShareTechnology,
		getWindShareFaultList,
		saveShareFault,
		saveShareCollection,
		saveFaultCollection,
		saveShareLikes,
		saveFaultLikes,
		getPCommentsByArticleIdShare,
		getPCommentsByArticleIdFault,
		shareCollectionCancel,
		saveUserIntegralConsumptions,
		getMyArticleList,
		getCommentInfo,
		//删除技术分享
		deleteShareDetail,
		deleteShareDetailFault,
		exceptionalIntegral,
		
		//文件管理
		getWindFilesList: (params = {}) => vm.$u.get('/mobile/wind/files/list', params),

		getWindResource: (params = {}) => vm.$u.get('/mobile/wind/getWindResource', params),

		getWindPlcs: (params = {}) => vm.$u.get('/mobile/wind/getWindPlcs', params),


		getWindIos: (params = {}) => vm.$u.get('/mobile/wind/getWindIos', params),


		getWindJobs: (params = {}) => vm.$u.get('/mobile/wind/getWindJobs', params),

		getWindJobInfo: (params = {}) => vm.$u.get('/mobile/wind/getWindJobInfo/' + params
			.id),
		jobNew: (params = {}) => vm.$u.postJson('/mobile/wind/jobNew',
			params),



		getWindSearchs: (params = {}) => vm.$u.get('/mobile/wind/getWindSearchs'),

		windSearch: (params = {}) => vm.$u.get('/mobile/wind/windSearch/' +
			params.search),

		getWindProjectCooperates: (params = {}) => vm.$u.get(config.adminPath +
			'/mobile/wind/getWindProjectCooperates',
			params),

		getWindProjectCooperateInfo: (params = {}) => vm.$u.get(config.adminPath +
			'/mobile/wind/getWindProjectCooperateInfo/' + params.id),


		browsesWindProjectCooperates: (params = {}) => vm.$u.get(config.adminPath +
			'/mobile/wind/browsesWindProjectCooperates/' + params.id),


		getWindCompanys: (params = {}) => vm.$u.get('/mobile/wind/getWindCompanys', params),


		getWindCompanyInfo: (params = {}) => vm.$u.get('/mobile/wind/getWindCompanyInfo/' +
			params
			.id),

		browsesWindCompanys: (params = {}) => vm.$u.get('/mobile/wind/browsesWindCompanys/' +
			params
			.id),

		giveNumber: (params = {}) => vm.$u.postJson('/mobile/wind/giveNumber', params),

		confirmGiveNumber: (params = {}) => vm.$u.postJson('/mobile/wind/confirmGiveNumber',
			params),

		//计算风电减排
		calcEnergy: (params = {}) => vm.$u.get('/mobile/wind/calcEnergy', params),

		getDictData: (params = {}) => vm.$u.get('/mobile/wind/getDictData/' + params
			.dictType),

		wxUserApply: (params = {}) => vm.$u.postJson('/mobile/wind/wx/wxUserApply', params),

		getWxUserInfo: (params = {}) => vm.$u.postJson('/mobile/wind/wx/getWxUserInfo',
			params),

		getWindProjectBuilds: (params = {}) => vm.$u.get('/mobile/wind/getWindProjectBuilds',
			params),

		getWindProjectBuildInfo: (params = {}) => vm.$u.get(
			'/mobile/wind/getWindProjectBuildInfo/' +
			params
			.id),

		browsesBuilds: (params = {}) => vm.$u.get('/mobile/wind/browsesBuilds/' +
			params
			.id),
		build: (params = {}) => vm.$u.postJson('/mobile/wind/build',
			params),

		getOtherUserInfo: (params = {}) => vm.$u.get('/mobile/wind/getUserInfo/' + params.userId),

		// APP公共服务
		upgradeCheck: () => vm.$u.post('/app/upgrade/check', {
			appCode: config.appCode,
			appVersion: config.appVersion
		}),
		commentSave: (params = {}) => vm.$u.post('/app/comment/save', params),

		// 个人信息修改
		user: {
			saveUserInfo: (params = {}) => vm.$u.post('/mobile/user/saveUserInfo', params),
			infoSavePwd: (params = {}) => vm.$u.put('/system/user/profile/updatePwd',
				params),
			infoSavePqa: (params = {}) => vm.$u.post('/sys/user/infoSavePqa', params),
		},

		// 员工用户查询
		empUser: {
			listData: (params = {}) => vm.$u.get('/sys/empUser/listData', params),
		},

		// 组织机构查询
		office: {
			treeData: (params = {}) => vm.$u.get('/sys/office/treeData', params),
		},

		// 增删改查例子
		testData: {
			form: (params = {}) => vm.$u.post('/test/testData/form', params),
			list: (params = {}) => vm.$u.post('/test/testData/listData', params),
			save: (params = {}) => vm.$u.postJson('/test/testData/save', params),
			disable: (params = {}) => vm.$u.post('/test/testData/disable', params),
			enable: (params = {}) => vm.$u.post('/test/testData/enable', params),
			delete: (params = {}) => vm.$u.post('/test/testData/delete', params),
		},

		article: {
			articleTypeList: (params = {}) => vm.$u.get('/wind/articleinfo/list', params),

			articleInfo: (params = {}) => vm.$u.get('/wind/articleinfo/' + params.articleId),
		},
		articleComments: {
			//  保存评论信息/
			saveWindComment: (params = {}) => vm.$u.post('/mobile/wind/check/writeComment', params),
			getPCommentsByArticleId: (params = {}) => vm.$u.get('/mobile/wind/getPCommentsByArticleId/' + params
				.articleId),
		},

		articleComment: {
			//  保存评论信息/
			saveWindComment: (params = {}) => vm.$u.postJson('/wind/comment', params),
			getArticleCommentList: (params = {}) => vm.$u.get('/wind/comment/list', params),
			saveWindReplyComment: (params = {}) => vm.$u.postJson('/wind/reply', params),
		},
		followInfo: {
			//  保存关注信息
			saveFollowInfo: (params = {}) => vm.$u.postJson('/wind/follow', params),
			getFollowInfo: (params = {}) => vm.$u.get('/wind/follow/list', params),
			delFollowInfo: (params = {}) => vm.$u.get('/wind/follow/removeInfo', params),
		},


		articleLike: {
			//  保存关注信息
			saveLikeInfo: (params = {}) => vm.$u.postJson('/wind/articleLike', params),
			getLikeInfo: (params = {}) => vm.$u.get('/wind/articleLike/list', params),
			delLikeInfo: (params = {}) => vm.$u.get('/wind/articleLike/removeInfo', params),
		},

		articleCollection: {
			//  获取所有收藏信息
			saveCollectionInfo: (params = {}) => vm.$u.postJson('/wind/articleCollection', params),
			getCollectionInfo: (params = {}) => vm.$u.get('/wind/articleCollection/list', params),
			delCollectionInfo: (params = {}) => vm.$u.get('/wind/articleCollection/removeInfo',
				params),
		},

		// 风电选电缆  
		powerChooseCable: {
			saveWindPowerInfo: (params = {}) => vm.$u.postJson('/wind/cable', params),
			getModelArea: (params = {}) => vm.$u.get('/wind/specificationsModel/adjacentModeInfo',
				params),
		},

		// 获取 电缆规格
		specificationsModel: {
			specificationsModelList: (params = {}) => vm.$u.get(config.adminPath +
				'/wind/specificationsModel/list', params),
		},


		getUserSignin: (params = {}) => vm.$u.get('/mobile/wind/getUserSignin/' +
			params
			.userId),
			//  获取发帖积分值
		getuserIntegrals: (params = {}) => vm.$u.get('/mobile/wind/getUserIntegrals/' +
			params
			.userId),	
		userSignin: (params = {}) => vm.$u.get('/mobile/wind/userSignin/' +
			params.userId + "/" + params.signinNum + "/" + params.signinTime),

		getUserIntegralConsumptions: (params = {}) => vm.$u.get('/mobile/wind/getUserIntegralConsumptions',
			params),

		getWindCommentsMsgs: (params = {}) => vm.$u.get('/mobile/wind/getWindCommentsMsgs', params),

		setWindCommentsMsgs: (params = {}) => vm.$u.get('/mobile/wind/setWindCommentsMsgs/' +
			params.msgId),

		getWindCommentsMsgDots: (params = {}) => vm.$u.get('/mobile/wind/getWindCommentsMsgDots/' +
			params.userId),
		getMyFans: (params = {}) => vm.$u.get('/mobile/wind/check/getMyFans/' +
				params.userId),
		getMyFollows: (params = {}) => vm.$u.get('/mobile/wind/check/getMyFollows/' +
						params.userId),
		getMyPraises: (params = {}) => vm.$u.get('/mobile/wind/check/getMyPraises/' +
						params.userId),				
						
	};

}

export default {
	install
}
